* alloc.c: Catch some string size overflows that we were missing.
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 8 Jun 2011 17:22:24 +0000 (10:22 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 8 Jun 2011 17:22:24 +0000 (10:22 -0700)
commit0f4de527eece03c0aa9573a08e8e2b6652fb43c3
tree077e6d7c16ac051d4e2ffbce5e2935339d94bab9
parent26f6a60d729252301635d25406c650338ddd0890
* alloc.c: Catch some string size overflows that we were missing.

(XMALLOC_OVERRUN_CHECK_SIZE) [!XMALLOC_OVERRUN_CHECK]: Define to 0,
for convenience in STRING_BYTES_MAX.
(STRING_BYTES_MAX): New macro, superseding the old one in lisp.h.
The definition here is exact; the one in lisp.h was approximate.
(allocate_string_data): Check for string overflow.  This catches
some instances we weren't catching before.  Also, it catches
size_t overflow on (unusual) hosts where SIZE_MAX <= min
(PTRDIFF_MAX, MOST_POSITIVE_FIXNUM), e.g., when size_t is 32 bits
and ptrdiff_t and EMACS_INT are both 64 bits.
* character.c, coding.c, doprnt.c, editfns.c, eval.c:
All uses of STRING_BYTES_MAX replaced by STRING_BYTES_BOUND.
* lisp.h (STRING_BYTES_BOUND): Renamed from STRING_BYTES_MAX.
src/ChangeLog
src/alloc.c
src/character.c
src/coding.c
src/doprnt.c
src/editfns.c
src/eval.c
src/lisp.h